package com.good.shopping.ware.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.good.common.utils.PageUtils;
import com.good.shopping.ware.entity.WareSkuEntity;
import com.good.shopping.ware.vo.SkuHasStockVo;
import com.good.shopping.ware.vo.WareSkuLockVo;

import java.util.List;
import java.util.Map;

/**
 * 商品库存
 *
 * @author yan
 * @email 821521880@qq.com
 * @date 2022-01-29 11:41:47
 */
public interface WareSkuService extends IService<WareSkuEntity> {

    PageUtils queryPage(Map<String, Object> params);


    /**
     * 添加库存
     * @param skuId
     * @param wareId
     * @param skuNum
     */
    void addStock(Long skuId, Long wareId, Integer skuNum);

    // 判断是否有库存
    List<SkuHasStockVo> getSkuHasStock(List<Long> skuIds);

    // 锁定库存
    boolean orderLockStock(WareSkuLockVo vo);

    // 测试远程分布式锁
    boolean testSeata(WareSkuLockVo vo);

}

